package com.whm.hrmanagement.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whm.hrmanagement.domain.OaSalary;
import com.whm.hrmanagement.domain.OaStaffAttendance;
import com.whm.hrmanagement.domain.dto.OaStaffSalaryDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 员工工资Mapper接口
 * 
 * @author whm
 * @date 2024-02-07
 */
public interface OaSalaryMapper  extends BaseMapper<OaSalary>
{
    /**
     * 查询员工工资
     * 
     * @param id 员工工资主键
     * @return 员工工资
     */
    public OaSalary selectOaSalaryById(String id);




    /**
     * 查询员工工资列表
     * 
     * @param oaSalary 员工工资
     * @return 员工工资集合
     */
    public List<OaSalary> selectOaSalaryList(OaSalary oaSalary);

    @Select("select ss.user_id staff_id,ss.dept_id,ss.nick_name name,ss.phonenumber phone,sd.dept_name dept_name,si.per_social_pay social_pay,si.per_house_pay house_pay " +
            "from sys_user ss inner join sys_dept sd on ss.dept_id = sd.dept_id left join oa_insurance si on ss.user_id = si.staff_id where ss.del_flag = 0")
    List<OaStaffSalaryDto> findStaffSalaryVO();


    @Select("select ss.user_id staff_id,ss.dept_id,ss.nick_name name,ss.phonenumber phone,sd.dept_name dept_name,si.per_social_pay social_pay,si.per_house_pay house_pay " +
            "from sys_user ss inner join sys_dept sd on ss.dept_id = sd.dept_id left join oa_insurance si on ss.user_id = si.staff_id  where ss.del_flag = 0 and ss.nick_name like concat('%',#{name},'%')")
    List<OaStaffSalaryDto> listStaffSalaryVO(@Param("name") String name);

    @Select("select ss.user_id staff_id,ss.dept_id,ss.nick_name name,ss.phonenumber phone,sd.dept_name dept_name,si.per_social_pay social_pay,si.per_house_pay house_pay " +
            "from sys_user ss inner join sys_dept sd on ss.dept_id = sd.dept_id left join oa_insurance si on ss.user_id = si.staff_id  where ss.del_flag = 0 and ss.dept_id = #{deptId} and ss.nick_name like concat('%',#{name},'%')")
    List<OaStaffSalaryDto> listStaffDeptSalaryVO(@Param("name") String name, @Param("deptId")Long deptId);





    /**
     * 新增员工工资
     * 
     * @param oaSalary 员工工资
     * @return 结果
     */
    public int insertOaSalary(OaSalary oaSalary);

    /**
     * 修改员工工资
     * 
     * @param oaSalary 员工工资
     * @return 结果
     */
    public int updateOaSalary(OaSalary oaSalary);

    /**
     * 删除员工工资
     * 
     * @param id 员工工资主键
     * @return 结果
     */
    public int deleteOaSalaryById(String id);

    /**
     * 批量删除员工工资
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOaSalaryByIds(String[] ids);
}
